﻿Imports System.Data.OleDb

Public Class BlockUser
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim prevPage As String = String.Empty
        If Request.Params("USER") = "" Then Response.Redirect(prevPage)

        If (Not IsPostBack) Then
            prevPage = Request.UrlReferrer.ToString()
        End If

        'Parse the URL to get the value in the Querystring
        Dim getQueryString As String = Request.QueryString("USER")

        'Delete the Comment Relationship
        Dim bUserOleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim bUserSqlString = "UPDATE PROFILE SET USER_BLCKD=@f1 WHERE USER_UNAME=@f2"
        Dim bUsercommand As OleDbCommand = New OleDbCommand(bUserSqlString, bUserOleDbConn)
        bUsercommand.CommandType = CommandType.Text
        bUsercommand.Parameters.AddWithValue("@f1", True)
        bUsercommand.Parameters.AddWithValue("@f2", getQueryString)
        bUserOleDbConn.Open()
        bUsercommand.ExecuteNonQuery()

        Response.Redirect(prevPage)

    End Sub

End Class